//
//  NTModuleFirstMediator.swift
//  NTFrameworks
//
//  Created by zto_yhd on 2020/1/17.
//

import CTMediator

public extension CTMediator{
    
    /// 跳转到第一个模块
    /// - Parameter callback: 回调
    @objc public func jumpToModuleFirst(callback:@escaping (String) -> Void) -> UIViewController? {
        let params = [
            "callback":callback,
            kCTMediatorParamsKeySwiftTargetModuleName:"ModuleFirst"
            ] as [AnyHashable : Any]
        if let viewController = self.performTarget("First", action: "Extension_ViewController", params: params, shouldCacheTarget: false) as? UIViewController {
            return viewController
        }
        return nil
    }
    
    
    /// 测试传值
    /// - Parameter params: 参数
    @objc public func testTransValue(params: Dictionary<String, Any>, callback: @escaping (String?) -> Void) -> UIViewController?{
        var tempParams = params
        tempParams["callback"] = callback
        tempParams[kCTMediatorParamsKeySwiftTargetModuleName] = "ModuleFirst"
        if let viewController = self.performTarget("First", action: "TestValue", params: tempParams, shouldCacheTarget: false) as? UIViewController{
            return viewController
        }
        return nil
    }
    
    
    
    
}

